import type { RouteRecordRaw } from 'vue-router';

//对外暴露配置路由
export const routes: Array<RouteRecordRaw> = [
    // 重定向 '/' 到 '/home'
    {
        path: '/',
        redirect: '/home'
    },
    //首页
    {
        path: '/home',
        name: 'home',
        component: () => import('@/page/home/index.vue'),
        meta: {
            isAuth: true,
        },
        children: [
            {
                path: '/home',
                redirect: '/home/statistics'
            },
            {
                path: '/home/statistics',
                name: 'statistics',
                component: () => import('@/page/statistics/index.vue'),
                meta: {
                    isAuth: true,
                    title: '数据统计',
                },
            },
            {
                path: '/home/release',
                name: 'release',
                component: () => import('@/page/home/release/index.vue'),
                meta: {
                    isAuth: true,
                    title: '发布文章',
                },
            },
            {
                path: '/home/article',
                name: 'article',
                component: () => import('@/page/home/article/index.vue'),
                meta: {
                    isAuth: true,
                    title: '文章管理',
                },
            },
            {
                path: '/home/sort',
                name: 'sort',
                component: () => import('@/page/home/sort/index.vue'),
                meta: {
                    isAuth: true,
                    title: '分类管理',
                },
            },
            {
                path: '/home/tag',
                name: 'tag',
                component: () => import('@/page/home/tag/index.vue'),
                meta: {
                    isAuth: true,
                    title: '标签管理',
                },
            },
            {
                path: '/home/album',
                name: 'album',
                component: () => import('@/page/home/album/index.vue'),
                meta: {
                    isAuth: true,
                    title: '相册管理',
                },
            },
            {
                path: '/home/setting',
                name: 'setting',
                component: () => import('@/page/home/setting/index.vue'),
                meta: {
                    isAuth: true,
                    title: '网站配置',
                },
            },
            {
                path: '/home/friend',
                name: 'friend',
                component: () => import('@/page/home/friend/index.vue'),
                meta: {
                    isAuth: true,
                    title: '友情管理',
                },
            },
        ]
    },
    //登录
    {
        path: '/login',
        name: 'login',
        component: () => import('@/page/login/index.vue'),
        meta: {
            title: '登录'
        }
    },
    //注册
    {
        path: '/register',
        name: 'register',
        component: () => import('@/page/register/index.vue'),
        meta: {
            title: '注册'
        }
    },
    //404页面
    {
        path: '/:pathMatch(.*)*',
        name: '404',
        component: () => import('@/page/error/404.vue'),
        meta: {
            title: '404'
        }
    }
]